﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using DataAccess;

namespace Business
{
    public class PlayerBUS
    {
        public static List<PlayerDTO> GetPlayerList()
        {
            return PlayerDAO.GetPlayerList();
        }

        public static bool AddNewPlayer(PlayerDTO dtoPlayer)
        {
            return PlayerDAO.AddNewPlayer(dtoPlayer);
        }

        /// <summary>
        /// Thêm danh sách cầu thủ vào CSDL
        /// </summary>
        /// <param name="lstPlayer">Danh sách cầu thủ</param>
        /// <returns>True: Nếu thêm thành công\nFalse: Nếu thất bại ít nhất 1 lần
        /// </returns>
        public static bool AddNewListPlayer(List<PlayerDTO> lstPlayer)
        {
            bool flag = true;
            foreach (var item in lstPlayer )
            {
               if(PlayerDAO.AddNewPlayer(item)==false )
                   flag =false;
            }
            return flag ;
        }

        public static bool UpdatePlayer(PlayerDTO dtoPlayer)
        {
            return PlayerDAO.UpdatePlayer(dtoPlayer);
        }

        public static bool DeleteAPlayer(PlayerDTO dtoPlayer)
        {
            return PlayerDAO.DeleteAPlayer(dtoPlayer);
        }

        public static bool DeleteAllPlayer()
        {
            return PlayerDAO.DeleteAllPlayer();
        }
    }
}
